package com.yc.menu.entity;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yc.base.BaseSimpleEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serial;

/**
 * <p>
 * 后台菜单表
 * </p>
 *
 * @author bao
 * @since 2021-12-09
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("yc_menu")
@ApiModel(value = "Menu对象", description = "后台菜单表")
public class Menu extends BaseSimpleEntity {

    @Serial
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "标题")
    @TableField("name")
    private String name;

    @ApiModelProperty(value = "父级菜单")
    @TableField("parent_id")
    private Long parentId;

    @ApiModelProperty(value = "外链?")
    @TableField("is_link")
    private Integer isLink;

    @ApiModelProperty(value = "缓存？")
    @TableField("is_cache")
    private Integer isCache;

    @ApiModelProperty(value = "身份验证？")
    @TableField("is_auth")
    private Integer isAuth;

    @ApiModelProperty(value = "可见?")
    @TableField("is_visible")
    private Integer isVisible;

    @ApiModelProperty(value = "权限")
    @TableField("permission")
    private String permission;

    @ApiModelProperty(value = "类型;1->菜单；2->按钮")
    @TableField("type")
    private Integer type;

    @ApiModelProperty(value = "图标")
    @TableField("icon")
    private String icon;

    @ApiModelProperty(value = "地址")
    @TableField("path")
    private String path;

    @ApiModelProperty(value = "组件名字")
    @TableField("component_name")
    private String componentName;

    @ApiModelProperty(value = "组件地址")
    @TableField("component_path")
    private String componentPath;

    @TableField("sort")
    private Integer sort;

    public void copy(Menu source) {
        BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
